package com.risk.ctrl.credit.controller;

import com.risk.ctrl.annotation.AutoLog;
import com.risk.ctrl.credit.service.CreditService;
import com.risk.ctrl.entity.base.Result;
import com.risk.ctrl.entity.req.AuthReq;
import com.risk.ctrl.entity.req.CreditQueryH5Req;
import com.risk.ctrl.entity.req.CreditQueryReq;
import com.risk.ctrl.entity.resp.AuthResp;
import com.risk.ctrl.entity.resp.CreditQueryH5Resp;
import com.risk.ctrl.entity.resp.CreditQueryResp;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description: 日志表
 * @Author: jeecg-boot
 * @Date: 2025-10-05
 * @Version: V1.0
 */
@Slf4j
@RestController
@RequestMapping("/V1")
@RequiredArgsConstructor
public class CreditController {

    private final CreditService creditService;

    /**
     * 征信授权
     * @param req
     * @return
     */
    @PostMapping("/jh-report")
    @AutoLog(value = "征信授权")
    public Result<AuthResp> jhReport(@RequestBody @Validated AuthReq req) {
        return creditService.auth(req);
    }

    /**
     * 征信查询
     * @param req
     * @return
     */
    @PostMapping("/find/jh-report")
    @AutoLog(value = "征信查询")
    public Result<CreditQueryResp> queryReport(@RequestBody @Validated CreditQueryReq req) {
        return creditService.query(req);
    }
    /**
     * 征信查询
     * @param req
     * @return
     */
    @PostMapping("/find/jh-h5-report")
    @AutoLog(value = "征信查询H5")
    public Result<CreditQueryH5Resp> queryReportH5(@RequestBody @Validated CreditQueryH5Req req) {
        return creditService.queryH5(req);
    }


}
